import http from '@/utils/http'

// 获取订单详情的接口方法
export const reqOrderInfo = () => http.get('/order/trade')

// 获取订单(默认收货)地址的接口方法
export const reqOrderAddress = () =>
  http.get('/userAddress/getOrderAddress')

/* 获取立即购买订单详情的接口方法(在商品详情页面点击立即购买) 
goodsId:商品Id(必填) blessing:祝福语(选填) */
export const reqBuyNowGoods = ({ goodsId, ...blessing }) =>
  http.get(`/order/buy/${goodsId}`, blessing)

/* 提交订单的接口方法
data:订单详情信息(对象) */
export const reqSubmitOrder = (data) =>
  http.post('/order/submitOrder', data)

/* 获取微信预支付信息
orderNo:提交订单成功服务器返回的订单号*/
export const reqPrePayInfo = (orderNo) =>
  http.get(`/webChat/createJsapi/${orderNo}`)

/* 微信支付状态查询
orderNo:提交订单成功服务器返回的订单号*/
export const reqPayStatus = (orderNo) =>
  http.get(`/webChat/queryPayStatus/${orderNo}`)
